Skip to content

fix: count only branches on added lines in diff coverage - #72

Merged
ideepu merged 3 commits into
mainfrom
fix/branch-coverage-in-diff
Aug 1, 2026
Merged

fix: count only branches on added lines in diff coverage#72
ideepu merged 3 commits into
mainfrom
fix/branch-coverage-in-diff

Conversation

@ideepu

@ideepu ideepu commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Diff coverage used whole-file branch totals, so branches outside the PR pulled the percentage down. Branch arcs are now selected by source line on added lines via select_diff_branches, and stored on FileDiffCoverage.
  • Removed fill_branch_missing_groups / _flatten_branches — arcs are not line ranges, so grouping them produced meaningless spans like [0, 11].
  • Missing branches render as source -> destination, with source -> exit for arcs leaving a scope (negative destination). Loop backward arcs normalize the link range.
  • Coverage badges keep a coarse rounded label and show the precise percentage (2 decimals) on hover.
  • README notes clarify added-line arc selection, whole-file branch badges vs diff-scoped links, and why report vs PR percentages can differ (# pragma: no branch / summary vs arc lists).

Test plan

  • make lint
  • make test

@ideepu

ideepu commented Jul 31, 2026

Copy link
Copy Markdown
Owner Author

Coverage report

  

Click to see the coverage of changed files
File Statements Missing Branches Missing
Coverage         
Coverage         
(new stmts)

Missing stmts              

Missing branches              
  codecov/coverage
  base.py
  pytest.py
Project Total    
Click to see whole project coverage
File Statements Missing Branches Missing
Coverage         

Missing stmts              

Missing branches              
  codecov
  badge.py
  config.py 99
  diff_grouper.py
  exceptions.py
  github.py 219 -> 207
  github_client.py 128, 130 127 -> 128, 129 -> 130
  groups.py
  log.py
  main.py 119-120 118 -> 119
  template.py
  codecov/coverage
  base.py 79-81, 106-108 58 -> 60
  jest.py 65-69, 73-74, 77-88, 94-106, 112-126, 145-159, 175-179, 194-212, 217 67 -> 68, 67 -> 69, 79 -> 80, 79 -> 88, 80 -> 81, 80 -> 85, 96 -> 97, 96 -> 106, 97 -> 98, 97 -> 102, 150 -> 151, 150 -> 158, 199 -> 200, 199 -> 212
  pytest.py
Project Total    

The pull request coverage percentage used the whole-file branch totals, so
branches outside the diff dragged it down. Branch arcs are now selected by
their source line and rendered as `source -> destination` instead of being
grouped into line ranges, which never made sense for arcs.
@ideepu
ideepu force-pushed the fix/branch-coverage-in-diff branch from 78c47cf to 1fd1369 Compare August 1, 2026 21:47
@ideepu
ideepu force-pushed the fix/branch-coverage-in-diff branch from 2163abf to b3707f8 Compare August 1, 2026 22:20
@ideepu
ideepu merged commit a75f50c into main Aug 1, 2026
2 checks passed
@ideepu
ideepu deleted the fix/branch-coverage-in-diff branch August 1, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant